if [ $# == 2 ]; then
	echo -n ""
else
	echo "usage: run-all.sh  #itr-start  #itr-end"
	echo "ex:    run-all.sh  0 3"
	exit
fi

type=`cat info/rule_type.var`
symm=`cat info/symm.var`
#dist=`cat info/dist.var`

for i in $(seq $1 $2); do

	echo iteration-$i $type $symm
	log=log.${i}; rm -rf $log
	echo -n "[Start] " >> $log
	date >> $log
	echo "WA" >> $log
	cd i${i}

	# WA
	cd wa;
	./run-giza.sh;
	./eval.sh >> ../../$log
	crossnum ${symm}-train.giza >> ../../$log

	cd ..;

	# TRAIN
	echo "[COPYCAT-TRAIN] " >> ../$log
	date >> ../$log
	./copycat-train.sh;


	# APPLY
	echo "[COPYCAT] " >> ../$log
	date >> ../$log
	./copycat.sh
	cat copycat/info.txt >> ../$log

	# smt
	echo "[SMT] " >> ../$log
	cd smt
	make realall2
#	make test_all
	make eval_all >> ../../$log
#	make clean
	cd ..


	# NEXT
	./make-next.sh;


	# end
	echo -n "[End] " >> ../$log
	date >> ../$log
	cd ..
done

